package easy.trace.agent.plugin;

import easy.trace.agent.define.Instrumentation;

import java.util.ArrayList;
import java.util.List;

/**
 * @author easy
 */
public class PluginDefine {
    private List<OfficialComponent> components = new ArrayList<>();

    public void addPlugin(OfficialComponent officialComponent) {
        components.add(officialComponent);
    }

    public List<OfficialComponent> getPlugin() {
        return components;
    }

    public static final String PLUGIN_REDIS = "redis";
    public static final String PLUGIN_HTTPCLIENT = "httpclient";
    public static final String PLUGIN_DUBBO = "dubbo";
    public static final String PLUGIN_MYBATIS = "mybatis";
    public static final String PLUGIN_ELASTIC_JOB = "elasticjob";
    public static final String PLUGIN_FEIGN = "feign";
    public static final String PLUGIN_SPRINGMVC = "springmvc";
    public static final String PLUGIN_HOMEPAGE = "homepage";
    public static final String PLUGIN_CROSSTHREAD="crossThread";


    public static final OfficialComponent REDIS = new OfficialComponent(1, PLUGIN_REDIS);

    public static final OfficialComponent HTTPCLIENT = new OfficialComponent(2, PLUGIN_HTTPCLIENT);

    public static final OfficialComponent DUBBO = new OfficialComponent(3, PLUGIN_DUBBO);

    public static final OfficialComponent MYBATIS = new OfficialComponent(4, PLUGIN_MYBATIS);

    public static final OfficialComponent ELASTIC_JOB = new OfficialComponent(5, PLUGIN_ELASTIC_JOB);

    public static final OfficialComponent FEIGN = new OfficialComponent(6, PLUGIN_FEIGN);

    public static final OfficialComponent SPRINGMVC = new OfficialComponent(7, PLUGIN_SPRINGMVC);

    public static final OfficialComponent HOMEPAGE = new OfficialComponent(8, PLUGIN_HOMEPAGE);

    public static final OfficialComponent CROSSTHREAD = new OfficialComponent(9, PLUGIN_CROSSTHREAD);


    static class OfficialComponent {

        private int priority;
        private String name;
        private String interceptorClass;
        private Instrumentation instrumentation;

        public OfficialComponent(int priority, String name) {
            this.priority = priority;
            this.name = name;
        }

        public int getPriority() {
            return priority;
        }

        public void setPriority(int priority) {
            this.priority = priority;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Instrumentation getInstrumentation() {
            return instrumentation;
        }

        public void setInstrumentation(Instrumentation instrumentation) {
            this.instrumentation = instrumentation;
        }

        public String getInterceptorClass() {
            return interceptorClass;
        }

        public void setInterceptorClass(String interceptorClass) {
            this.interceptorClass = interceptorClass;
        }
    }


}


